package com.procurement.material.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.procurement.material.mapper.PcmMaterialRecordMapper;
import com.procurement.material.domain.PcmMaterialRecord;
import com.procurement.material.service.IPcmMaterialRecordService;

/**
 * 物料档案Service业务层处理
 * 
 * @author liyang
 * @date 2023-12-05
 */
@Service
public class PcmMaterialRecordServiceImpl implements IPcmMaterialRecordService 
{
    @Autowired
    private PcmMaterialRecordMapper pcmMaterialRecordMapper;

    /**
     * 查询物料档案
     * 
     * @param productNumber 物料档案主键
     * @return 物料档案
     */
    @Override
    public PcmMaterialRecord selectPcmMaterialRecordByProductNumber(String productNumber)
    {
        return pcmMaterialRecordMapper.selectPcmMaterialRecordByProductNumber(productNumber);
    }

    /**
     * 查询物料档案列表
     * 
     * @param pcmMaterialRecord 物料档案
     * @return 物料档案
     */
    @Override
    public List<PcmMaterialRecord> selectPcmMaterialRecordList(PcmMaterialRecord pcmMaterialRecord)
    {
        return pcmMaterialRecordMapper.selectPcmMaterialRecordList(pcmMaterialRecord);
    }

    /**
     * 新增物料档案
     * 
     * @param pcmMaterialRecord 物料档案
     * @return 结果
     */
    @Override
    public int insertPcmMaterialRecord(PcmMaterialRecord pcmMaterialRecord)
    {
        return pcmMaterialRecordMapper.insertPcmMaterialRecord(pcmMaterialRecord);
    }

    /**
     * 修改物料档案
     * 
     * @param pcmMaterialRecord 物料档案
     * @return 结果
     */
    @Override
    public int updatePcmMaterialRecord(PcmMaterialRecord pcmMaterialRecord)
    {
        pcmMaterialRecord.setUpdateTime(DateUtils.getNowDate());
        return pcmMaterialRecordMapper.updatePcmMaterialRecord(pcmMaterialRecord);
    }

    /**
     * 批量删除物料档案
     * 
     * @param productNumbers 需要删除的物料档案主键
     * @return 结果
     */
    @Override
    public int deletePcmMaterialRecordByProductNumbers(String[] productNumbers)
    {
        return pcmMaterialRecordMapper.deletePcmMaterialRecordByProductNumbers(productNumbers);
    }

    /**
     * 删除物料档案信息
     * 
     * @param productNumber 物料档案主键
     * @return 结果
     */
    @Override
    public int deletePcmMaterialRecordByProductNumber(String productNumber)
    {
        return pcmMaterialRecordMapper.deletePcmMaterialRecordByProductNumber(productNumber);
    }

    public String getMaxProductNumber(){
        return pcmMaterialRecordMapper.getMaxProductNumber();
    };
}
